package com.example.x5webviewdemo;

import android.app.Application;
import android.util.Log;

import com.example.x5webviewdemo.service.MyIntentService;
import com.tencent.smtt.sdk.QbSdk;


/**
 * @作者: njb
 * @时间: 2019/11/8 10:18
 * @描述:
 */
public class App extends Application {
    private static App mInstance;


    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        MyIntentService.start(this);
/*        AutoSizeConfig.getInstance().getUnitsManager()
                .setSupportDP(false)
                .setSupportSP(false)
                .setSupportSubunits(Subunits.MM);*/
        //initX5WebView();
    }

    private void initX5WebView(){
        QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {

            @Override
            public void onViewInitFinished(boolean arg0) {
                // TODO Auto-generated method stub
                //x5內核初始化完成的回调，为true表示x5内核加载成功，否则表示x5内核加载失败，会自动切换到系统内核。
                Log.d("app", " onViewInitFinished is " + arg0);
            }

            @Override
            public void onCoreInitFinished() {
                // TODO Auto-generated method stub
            }
        };
        //x5内核初始化接口
        QbSdk.initX5Environment(getApplicationContext(),  cb);
    }

    public static App  getmInstance() {
        return  mInstance;
    }
}
